#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int is_perfer_num(int n)
{
	int sum = 1;
	for (int i = 2; i <= (int)sqrt(n); ++i)
	{
		if (i * i == n)
			sum += i;
		else if (n % i == 0)
			sum += (i + n / i);
	}
	if (sum == n)
		return 1;
	else
		return 0;
}


int main() 
{
	int num = 0;
	int n = 0;
	scanf("%d", &n);
	for (int i = 2; i <= n; ++i)
	{
		if (is_perfer_num(i))
			++num;
	}
	printf("%d", num);
	return 0;
}